﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace PJ.Data
{
    [Serializable]
    [DataContract]
    public abstract class BaseItemData : BaseEntityData, IItemData
    {
        private string m_Name;
        private string m_Alias;

        [DataMember]
        public string Name
        {
            get { return m_Name; }
            set { m_Name = value; }
        }

        [DataMember]
        public string AliasName
        {
            get { return m_Alias; }
            set { m_Alias = value; }
        }
        
        protected BaseItemData()
        {
        }
        public override IObjectData Init(IObjectData data)
        {
            base.Init(data);
            IItemData temp = (IItemData)data;
            this.Name = temp.Name;
            this.AliasName = temp.AliasName;
            return this;
        }
        public override IObjectData Copy(IObjectData data)
        {
            base.Copy(data);
            IItemData temp = (IItemData)data;
            this.Name = temp.Name;
            this.AliasName = temp.AliasName;
            return this;
        }
        public override bool IsEqual(IObjectData data)
        {
            if (base.IsEqual(data))
            {
                IItemData temp = (IItemData)data;
                if (temp.Name == this.Name)
                    if (temp.AliasName == this.AliasName)
                        return true;
            }
            return false;
        }


    }
}
